#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2021/4/28 16:56
# @Author  : Link
# @Site    : 
# @File    : charts.py
# @Software: PyCharm


def generator_echarts_data() -> dict:
    curr = [0., 0.5, 1., 1.5, 2., 2.5, 3., 3.5, 4., 4.5, 5.,
            5.5, 6., 6.5, 7., 7.5, 8., 8.5, 9., 9.5, 10., 10.5,
            11., 11.5, 12., 12.5, 13., 13.5, 14., 14.5, 15., 15.5, 16.,
            16.5, 17., 17.5, 18., 18.5, 19., 19.5, 20., 20.5, 21., 21.5,
            22., 22.5, 23., 23.5, 24., 24.5, 25., 25.5, 26., 26.5, 27.,
            27.5, 28., 28.5, 29., 29.5, 30., 30.5, 31., 31.5, 32., 32.5,
            33., 33.5, 34., 34.5, 35., 35.5, 36., 36.5, 37., 37.5, 38.,
            38.5, 39., 39.5, 40., 40.5, 41., 41.5, 42., 42.5, 43., 43.5,
            44., 44.5, 45., 45.5, 46., 46.5, 47., 47.5, 48., 48.5, 49.,
            49.5, 50., 50.5, 51., 51.5, 52., 52.5, 53., 53.5, 54., 54.5,
            55., 55.5, 56., 56.5, 57., 57.5, 58., 58.5, 59., 59.5, 60.,
            60.5, 61., 61.5, 62., 62.5, 63., 63.5, 64., 64.5, 65., 65.5,
            66., 66.5, 67., 67.5, 68., 68.5, 69., 69.5, 70., 70.5, 71.,
            71.5, 72., 72.5, 73., 73.5, 74., 74.5, 75., 75.5, 76., 76.5,
            77., 77.5, 78., 78.5, 79., 79.5, 80.]
    po = [0.0129098, 0.01318448, 0.01387117, 0.01519878, 0.01616015,
          0.01753353, 0.01927314, 0.02105854, 0.02201991, 0.0227066,
          0.02353063, 0.02453779, 0.02412577, 0.0254076, 0.02682676,
          0.02971086, 0.03030599, 0.03236607, 0.03401413, 0.03547907,
          0.03648622, 0.03634888, 0.03731025, 0.03744759, 0.03882097,
          0.04060637, 0.04248333, 0.04436028, 0.04582523, 0.04715283,
          0.04802264, 0.04880089, 0.04994536, 0.05159344, 0.05324147,
          0.05401976, 0.05447755, 0.05507269, 0.05694964, 0.05878081,
          0.06097822, 0.06409124, 0.06702111, 0.0697679, 0.07054614,
          0.07219417, 0.07402534, 0.07645167, 0.07947314, 0.08167054,
          0.08460042, 0.08821699, 0.09838001, 0.13633118, 0.22441086,
          0.35694237, 0.51117351, 0.66371037, 0.81624771, 0.9649849,
          1.11468381, 1.26250554, 1.41234177, 1.55865298, 1.70395669,
          1.84765834, 1.99195552, 2.13533675, 2.27803091, 2.41930657,
          2.55934587, 2.69691293, 2.83269484, 2.96829364, 3.10082516,
          3.23363132, 3.3623174, 3.492514, 3.61936867, 3.74585762,
          3.87225455, 3.99434832, 4.11854813, 4.23569789, 4.35852355,
          4.47727585, 4.59740088, 4.71326899, 4.82698668, 4.94321814,
          5.05666073, 5.16946154, 5.28015772, 5.39181184, 5.50209275,
          5.61054745, 5.7166191, 5.82566366, 5.9309095, 6.0343244,
          6.13650767, 6.24014907, 6.33903382, 6.43695591, 6.53556697,
          6.63275291, 6.72925933, 6.8219623, 6.91640656, 7.00764195,
          7.09100621, 7.17684317, 7.25814998, 7.34769129, 7.43604815,
          7.52019103, 7.60419705, 7.68220535, 7.76648507, 7.84737662,
          7.93440275, 8.00810739, 8.09124514, 8.16027807, 8.24492587,
          8.31546885, 8.39508157, 8.46704494, 8.53136839, 8.59651294,
          8.66174714, 8.73517809, 8.80169584, 8.86775586, 8.92969154,
          8.99359974, 9.05338832, 9.11670193, 9.17534382, 9.23170175,
          9.2871395, 9.34504996, 9.39934573, 9.44956437, 9.49937246,
          9.55270557, 9.6059915, 9.66166047, 9.71526728, 9.76910532,
          9.81946081, 9.86080317, 9.9080017, 9.95007078, 9.99562242,
          10.03361908, 10.0753248, 10.11666245, 10.156306, 10.19041428,
          10.23234651]
    vf = [-0.2439003, 0.8340549, 0.8703957, 0.8942337, 0.9132137,
          0.9294701, 0.9441128, 0.9575901, 0.9701881, 0.9820347,
          0.9933929, 1.004303, 1.014858, 1.025032, 1.034952,
          1.044645, 1.054096, 1.063309, 1.07238, 1.081301,
          1.090061, 1.098654, 1.107182, 1.115574, 1.123842,
          1.131985, 1.140043, 1.148014, 1.155863, 1.163689,
          1.171452, 1.179094, 1.186657, 1.194195, 1.201632,
          1.209021, 1.216314, 1.223545, 1.230743, 1.237892,
          1.244904, 1.251905, 1.258873, 1.265747, 1.272558,
          1.279364, 1.286058, 1.292723, 1.299339, 1.305923,
          1.31246, 1.318939, 1.325462, 1.332172, 1.339119,
          1.345964, 1.352892, 1.359823, 1.366613, 1.373341,
          1.38018, 1.386822, 1.393412, 1.400015, 1.406603,
          1.413036, 1.419323, 1.425604, 1.431854, 1.437937,
          1.443947, 1.450106, 1.456057, 1.461819, 1.467772,
          1.473667, 1.479542, 1.485361, 1.491369, 1.497055,
          1.502993, 1.508928, 1.514605, 1.520494, 1.526333,
          1.53187, 1.537489, 1.54298, 1.54858, 1.554089,
          1.559256, 1.564819, 1.57025, 1.575901, 1.581202,
          1.58658, 1.591991, 1.597136, 1.602377, 1.60755,
          1.612652, 1.617702, 1.622503, 1.627596, 1.632524,
          1.637568, 1.642706, 1.647749, 1.652515, 1.657076,
          1.661722, 1.666849, 1.671595, 1.67671, 1.68223,
          1.687908, 1.692556, 1.697517, 1.702471, 1.707779,
          1.712856, 1.718225, 1.723114, 1.728251, 1.733397,
          1.738558, 1.743683, 1.749033, 1.754227, 1.759501,
          1.765146, 1.771357, 1.777702, 1.783911, 1.789862,
          1.794268, 1.782465, 1.787537, 1.792578, 1.797981,
          1.803875, 1.809786, 1.816111, 1.823109, 1.831219,
          1.838552, 1.847265, 1.85552, 1.86401, 1.871613,
          1.878784, 1.887022, 1.893229, 1.906916, 1.937336,
          1.974302, 1.972857, 1.950893, 1.949223, 1.933647,
          1.933228]
    im = [6.146729e-02, 4.656613e-02, 1.614293e-02, 3.228585e-02,
          8.195639e-02, 1.266599e-01, 1.682589e-01, 2.067536e-01,
          2.477318e-01, 2.868474e-01, 3.253420e-01, 3.588696e-01,
          3.923973e-01, 4.240622e-01, 4.582107e-01, 4.923592e-01,
          5.277495e-01, 5.618979e-01, 5.960464e-01, 6.332994e-01,
          6.705523e-01, 7.078052e-01, 7.407119e-01, 7.723768e-01,
          8.059044e-01, 8.406739e-01, 8.766850e-01, 9.102126e-01,
          9.431193e-01, 9.791305e-01, 1.012658e+00, 1.045565e+00,
          1.080955e+00, 1.113862e+00, 1.153598e+00, 1.187126e+00,
          1.227483e+00, 1.260390e+00, 1.298264e+00, 1.334896e+00,
          1.378978e+00, 1.421198e+00, 1.460935e+00, 1.497567e+00,
          1.536061e+00, 1.578281e+00, 1.621743e+00, 1.667067e+00,
          1.710529e+00, 1.762683e+00, 1.821667e+00, 1.907970e+00,
          2.112861e+00, 3.000100e+00, 5.009274e+00, 8.078913e+00,
          1.163843e+01, 1.522899e+01, 1.880527e+01, 2.235422e+01,
          2.588580e+01, 2.938074e+01, 3.286389e+01, 3.630978e+01,
          3.973705e+01, 4.313948e+01, 4.651894e+01, 4.986922e+01,
          5.317914e+01, 5.644932e+01, 5.966487e+01, 6.284068e+01,
          6.596868e+01, 6.906502e+01, 7.212783e+01, 7.517636e+01,
          7.821744e+01, 8.125728e+01, 8.429649e+01, 8.734068e+01,
          9.036499e+01, 9.337129e+01, 9.636705e+01, 9.935349e+01,
          1.023492e+02, 1.053078e+02, 1.082507e+02, 1.111583e+02,
          1.140572e+02, 1.169325e+02, 1.197706e+02, 1.225794e+02,
          1.253529e+02, 1.280767e+02, 1.307291e+02, 1.333046e+02,
          1.357986e+02, 1.382089e+02, 1.405378e+02, 1.427885e+02,
          1.449920e+02, 1.471664e+02, 1.493494e+02, 1.515386e+02,
          1.537676e+02, 1.559990e+02, 1.582497e+02, 1.604843e+02,
          1.627455e+02, 1.649925e+02, 1.672364e+02, 1.694833e+02,
          1.717390e+02, 1.740151e+02, 1.762845e+02, 1.785643e+02,
          1.808095e+02, 1.830403e+02, 1.852320e+02, 1.874082e+02,
          1.894863e+02, 1.914259e+02, 1.932395e+02, 1.948904e+02,
          1.964420e+02, 1.978688e+02, 1.992118e+02, 2.005057e+02,
          2.017803e+02, 2.031239e+02, 2.045128e+02, 2.059297e+02,
          2.073857e+02, 2.088876e+02, 2.104795e+02, 2.121242e+02,
          2.138360e+02, 2.155956e+02, 2.174110e+02, 2.192259e+02,
          2.210283e+02, 2.227978e+02, 2.245263e+02, 2.261698e+02,
          2.277133e+02, 2.290898e+02, 2.302608e+02, 2.311959e+02,
          2.319912e+02, 2.326742e+02, 2.332907e+02, 2.338700e+02,
          2.344561e+02, 2.350913e+02, 2.357655e+02, 2.365534e+02,
          2.374450e+02, 2.384353e+02, 2.395362e+02, 2.407680e+02,
          2.422103e+02]
    de = [0.00090797, 0.00067906, 0.002144, 0.00232712, 0.00221267,
          0.00317404, 0.00372339, 0.00280018, 0.00148783, 0.00143442,
          0.0020906, 0.00034335, 0.00061039, 0.00273914, 0.00470765,
          0.00347924, 0.00234238, 0.00398282, 0.00312063, 0.00263231,
          0.00061039, 0.00077062, 0.00107582, 0.00130471, 0.00334953,
          0.00373103, 0.00383785, 0.00336479, 0.00280018, 0.00218979,
          0.00151072, 0.00182352, 0.0028536, 0.003525, 0.00247973,
          0.00106822, 0.00078588, 0.00250262, 0.00386071, 0.00386835,
          0.00540199, 0.00622601, 0.00597423, 0.00334954, 0.00206766,
          0.00352498, 0.00418883, 0.00568433, 0.00519599, 0.00487549,
          0.00557745, 0.00926268, 0.04085051, 0.12325356, 0.22534934,
          0.29445368, 0.31038453, 0.30542517, 0.30111432, 0.29811561,
          0.29734517, 0.2979326, 0.2966511, 0.29129443, 0.2887382,
          0.28788447, 0.28789217, 0.28615916, 0.28406136, 0.28149058,
          0.27769784, 0.27296744, 0.2715944, 0.26805404, 0.26551314,
          0.26128625, 0.25875299, 0.25736398, 0.25280197, 0.25354213,
          0.24812435, 0.24675138, 0.24075459, 0.23947931, 0.24229516,
          0.23890793, 0.23658033, 0.22845735, 0.23005557, 0.23019997,
          0.22612936, 0.22323037, 0.22222839, 0.22239906, 0.21890392,
          0.21372649, 0.21535215, 0.21509104, 0.20823289, 0.20504999,
          0.20641218, 0.20292962, 0.19589924, 0.19661022, 0.19602507,
          0.19408875, 0.18880593, 0.18704813, 0.18728172, 0.17365272,
          0.16864439, 0.16618348, 0.1702905, 0.17997292, 0.17232514,
          0.16844619, 0.16094627, 0.16185309, 0.16519408, 0.16957323,
          0.16018102, 0.15697295, 0.15114038, 0.15368073, 0.15628163,
          0.14907979, 0.15436104, 0.13487508, 0.12817974, 0.12914947,
          0.1398323, 0.14139111, 0.13211295, 0.12759066, 0.12584309,
          0.12343802, 0.12319421, 0.12292366, 0.11437457, 0.11100291,
          0.11379729, 0.11329787, 0.10398038, 0.0987597, 0.10308065,
          0.10680937, 0.10929073, 0.10963442, 0.10768158, 0.10573425,
          0.0901414, 0.08789362, 0.08966321, 0.08802497, 0.08351054,
          0.07850456, 0.08394389, 0.08184241, 0.0721655, 0.06872069,
          0.10919478]

    colors = ['#5793f3', '#d14a61', '#675bba', '#A87958']
    return {
        "color": colors,

        "tooltip": {
            "trigger": 'axis',
            "axisPointer": {
                "type": 'cross'
            },
        },
        "toolbox": {
            "feature": {
                "saveAsImage": {
                    "show": True
                }
            }
        },
        "grid": {
            "right": '20%'
        },
        "legend": {
            "data": ['Im', 'Po', 'Vf', 'De']
        },
        "xAxis": [{
            "type": 'category',
            "axisTick": {
                "alignWithLabel": False
            },
            "data": [str(each) for each in curr]
        }],
        "yAxis": [
            {
                "type": 'value',
                "name": 'Im',
                "min": 0,
                "position": 'left',
                "axisLine": {
                    "show": True,
                    "lineStyle": {
                        "color": colors[0]
                    }
                },
                "axisLabel": {
                    "formatter": '{value}'
                }
            },
            {
                "type": 'value',
                "name": 'Po',
                "min": 0,
                "position": 'right',
                "axisLine": {
                    "show": True,
                    "lineStyle": {
                        "color": colors[1]
                    }
                },
                "axisLabel": {
                    "formatter": '{value}'
                }
            },
            {
                "type": 'value',
                "name": 'Vf',
                "min": 0,
                "position": 'right',
                "offset": 40,
                "axisLine": {
                    "show": True,
                    "lineStyle": {
                        "color": colors[2]
                    }
                },
                "axisLabel": {
                    "formatter": '{value}'
                }
            },
            {
                "type": 'value',
                "name": 'De',
                "min": 0,
                "position": 'right',
                "offset": 80,
                "axisLine": {
                    "show": True,
                    "lineStyle": {
                        "color": colors[3]
                    }
                },
                "axisLabel": {
                    "formatter": '{value}'
                }
            }
        ],
        "series": [
            {
                "name": 'Im',
                "type": 'line',
                "data": im,
                "color": colors[0]
            },
            {
                "name": 'Vf',
                "type": 'line',
                "yAxisIndex": 1,
                "data": vf,
                "color": colors[1]
            },
            {
                "name": 'Po',
                "type": 'line',
                "yAxisIndex": 2,
                "data": po,
                "color": colors[2]
            },
            {
                "name": 'De',
                "type": 'line',
                "yAxisIndex": 3,
                "data": de,
                "color": colors[3]
            }
        ]
    }
